/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lesson3.com.demo.ser.better;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;


public class SerializeCat {
    
    public static void main(String[] args) throws IOException{
        Cat myCat = new Cat();
        myCat.setAge(6);
        myCat.setName("Fluffy");
        myCat.setWeight(125);
        
        File f = new File("fluffy.ser");
        FileOutputStream fos = new FileOutputStream(f);
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        
        oos.writeObject(myCat);
        
        oos.flush();
        oos.close();
        System.out.println("Just serialized a cat :" +myCat);
    }

}
